//
//  SettingViewController.m
//  ShouYi
//
//  Created by yurui on 16/2/23.
//  Copyright © 2016年 yurui. All rights reserved.
//

#import "SettingViewController.h"
#import "SetTableViewCell.h"
@interface SettingViewController ()<UITableViewDataSource,UITableViewDelegate>
@property(nonatomic,strong) UIView *headerView;
@property(nonatomic,strong) UIView *footerView;
@property(nonatomic,strong) UILabel *userNameLabel;
@property(nonatomic,strong) UIImageView *userNameImageView;
@property(nonatomic,strong) UITableView *tableView;
@property(nonatomic,strong) UIButton *saveBt;
@end

@implementation SettingViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = kViewBackColor;
    self.tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 70, kWidth, kHeight)];
    self.tableView.backgroundColor = kViewBackColor;
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    self.navigationItem.rightBarButtonItem = self.editButtonItem;
    [self.tableView registerClass:[SetTableViewCell class] forCellReuseIdentifier:@"cell"];
    [self.view addSubview:_tableView];
    [self addHeaderView];
    self.automaticallyAdjustsScrollViewInsets = NO;
    //self.tableView.tableHeaderView
}
- (void)addHeaderView{
    UIView *View = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kWidth, 90)];
    View.backgroundColor = kViewBackColor;
    
    self.headerView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kWidth, 80)];
    self.headerView.backgroundColor = [UIColor whiteColor];
    [View addSubview:_headerView];
    self.userNameLabel = [[UILabel alloc]initWithFrame:CGRectMake(15, 30, 50, 20)];
    self.userNameLabel.text = @"头像";
    self.userNameLabel.font = [UIFont systemFontOfSize:15];
    [self.headerView addSubview:_userNameLabel];
    //
    self.userNameImageView = [[UIImageView alloc]initWithFrame:CGRectMake(kWidth - 80, 10, 60, 60)];
    self.userNameImageView.backgroundColor = [UIColor grayColor];
    self.userNameImageView.layer.cornerRadius = 30;
    self.userNameImageView.layer.masksToBounds = YES;
    [self.headerView addSubview:_userNameImageView];
    self.tableView.tableHeaderView = View;

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 7;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 80;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 40;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    SetTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];
    if (indexPath.row == 0) {
        cell.textF.placeholder = @"请输入昵称";
        cell.titleLbael.text = @"昵称";
    } else if (indexPath.row == 1){
    cell.textF.placeholder = @"请输入这是姓名";
    cell.titleLbael.text = @"真实姓名";
    } else if (indexPath.row == 2){
        cell.textF.placeholder = @"请输入手机号";
        cell.titleLbael.text = @"手机号";
    } else if (indexPath.row == 3){
        cell.textF.text = @"请选择  ⬇️";
        //cell.textF.textAlignment = NSTextAlignmentCenter;
        cell.textF.font = [UIFont systemFontOfSize:14];
        cell.titleLbael.text = @"收款类型";
    } else if (indexPath.row == 4){
        cell.textF.placeholder = @"支付姓名";
        cell.titleLbael.text = @"请输入支付姓名";
    } else if (indexPath.row == 5){
        cell.textF.placeholder = @"请输入收款姓名";
        cell.titleLbael.text = @"收款姓名";
    }else if (indexPath.row == 6){
        cell.textF.placeholder = @"请输入收款账号";
        cell.titleLbael.text = @"收款账号";
    }
    // Configure the cell...
    
    return cell;
}


/*
 // Override to support conditional editing of the table view.
 - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
 // Return NO if you do not want the specified item to be editable.
 return YES;
 }
 */

/*
 // Override to support editing the table view.
 - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
 if (editingStyle == UITableViewCellEditingStyleDelete) {
 // Delete the row from the data source
 [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
 } else if (editingStyle == UITableViewCellEditingStyleInsert) {
 // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
 }
 }
 */

/*
 // Override to support rearranging the table view.
 - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
 }
 */

/*
 // Override to support conditional rearranging of the table view.
 - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
 // Return NO if you do not want the item to be re-orderable.
 return YES;
 }
 */

/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end
